import navMenuTpl from './tpl/nav_menu.tpl';
import navMenuItemTpl from './tpl/nav_menu_item.tpl';
import './index.scss'
import tools from '../../../../utils/tools';
class NavMenu {
  constructor () {
    this.name = 'navMenu';
    this.tpl = navMenuTpl;
  }
  appendMenuCards (data) {
    let list = '';
    data.forEach((item, idx) => {
      list += tools.tplReplace(navMenuItemTpl(), {
        id: item.id,
        phone_name: item.phone_name,
        default_price: item.default_price,
        pic: $.parseJSON(item.pics)[0][0][0],
        isFirst: idx === 0 ? 'first' : ''
      })
    })
    return list;
  }
}
export { NavMenu }